-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: add XPNFTToken with MetadataGenerator #12
base: main
Are you sure you want to change the base?
Conversation
e1431a6
to
84a547d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very well done. This is pretty much what I had imagined.
function balanceOf(address account) external view returns (uint256); | ||
} | ||
|
||
contract XPNFTToken is Ownable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nitpick: shall we make this Ownable2step
?
} | ||
|
||
function mint() external { | ||
emit Transfer(msg.sender, msg.sender, uint256(uint160(msg.sender))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate on why we're doing it this way again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see, so an account's address is essentially the ID for the token.
This means every account automatically "owns" this NFT with most of them having 0
XP
function tokenURI(uint256 tokenId) external view onlyValidTokenId(tokenId) returns (string memory) { | ||
address account = address(uint160(tokenId)); | ||
uint256 balance = xpToken.balanceOf(account); | ||
return metadataGenerator.generate(account, balance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice
This is not passing the linter |
base PoC of the XP NFT Token with dynamic on-chain metadata with info from the XP Token
output of the
tokenUri
function:with
SVG_BASE64_ENCODED
as the base64 of:that renders like the following image:
closes #37